package org.jetlinks.pro.koudai.entity;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hswebframework.ezorm.rdb.mapping.annotation.DefaultValue;
import org.hswebframework.web.api.crud.entity.GenericEntity;
import org.hswebframework.web.crud.generator.Generators;
import org.hswebframework.web.validator.CreateGroup;
import reactor.core.publisher.Mono;

import javax.persistence.Column;
import javax.persistence.Index;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import java.util.Date;

/**
 * 实验课程信息
 *
 * @author zhoukun
 * @since 1.3
 */
@Getter
@Setter
@AllArgsConstructor(staticName = "of")
@NoArgsConstructor
public class CourseInfo  {

    @Schema(description = "课程名称")
    private String courseId;

    @Schema(description = "课程名称")
    private String courseName;

    @Schema(description = "课程类型")
    private String courseTypeId;

    @Schema(description = "课程类型名称")
    private String courseTypeName;

    @DefaultValue(generator = Generators.CURRENT_TIME)
    private Date createTime;

    @DefaultValue(generator = Generators.CURRENT_TIME)
    private Date updateTime;

    public  CourseInfo with(CourseEntity courseEntity)
    {
        setCourseId(courseEntity.getId());
        setCreateTime(courseEntity.getCreateTime());
        setUpdateTime(courseEntity.getUpdateTime());
        setCourseName(courseEntity.getCourseName());
        setCourseTypeId(courseEntity.getCourseTypeId());
        return this;
    }

    public  Mono<CourseInfo> with(CourseTypeEntity courseType)
    {
        setCourseTypeName(courseType.getCourseTypeName());
        return Mono.just(this);
    }

}
